﻿namespace Seagull.Foundation
{
    public interface IRepository<TEntity> where TEntity : class, new()
    {
        /// <summary>
        /// 创建一个新的记录,并返回创建记录的ID。
        /// </summary>
        /// <param name="data"></param>
        /// <returns></returns>
        ulong Create(TEntity data);

        /// <summary>
        /// 删除记录
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        void Delete(long id);

        /// <summary>
        /// 根据主键的id集删除记录集
        /// </summary>
        /// <param name="ids"></param>
        /// <returns></returns>
        void DeleteFor(long[] ids);

        /// <summary>
        /// 修改记录
        /// </summary>
        /// <param name="data"></param>
        void Write(IEntityDictionary<TEntity> data);
    }
}
